﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Revenue
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent1" runat="server">
    <span class="AdminTitle" style="color: #cc0000;">Doanh thu Management</span> (<a
        href="<%= Url.Action("Index", "Home") %>" class="AdminPageText">
        <%= WebConfiguration.SiteName  %>
    </a>| <a href="<%= Url.Action("LogOff", "Account") %>" class="AdminPageText">LogOut
    </a>)
    <br />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent2" runat="server">
    <script type="text/javascript">
        function CallPrint(strid) {
            var prtContent = document.getElementById(strid);
            var WinPrint = window.open('', '', 'letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
            WinPrint.document.write(prtContent.innerHTML);
            WinPrint.document.close();
            WinPrint.focus();
            WinPrint.print();
            WinPrint.close();
        }
    </script>
    <span class="AdminPageText">
        <% if (Model.DonDatHangModel != null)
           {
               var total = 0.0;
               foreach (var order in Model.DonDatHangModel.GetModel.LstObjModel)
               {
                   foreach (var detail in order.ChiTietDonDatHang)
                   {
                       total += (detail.SoLuong.Value * detail.Gia.Value);
                   }
               }
        %>
        <a href="#" onclick="javascript:CallPrint('NeedPrint');" style="float: right;">
            <img title="In" src="../../../Content/Images/Home/printer.jpg" alt="Import files"
                style="border-width: 0px; width: 32px; height: 32px;" />
        </a>Tổng doanh thu: <span id="lblDoanhThu" style="font-weight: bold; color: Red">
            <%= string.Format("{0:0,0}", total)%>
            Đ</span>
        <br />
        <br />
        <div id="PartialDiv">
            <% Html.RenderPartial("Templates/TH_ListOrders", Model); %>
        </div>
        <br />
        <br />
        <% } %>
    </span>
    <div id="NeedPrint" style="visibility: hidden;">
        <% if (Model.DonDatHangModel != null)
           {
               var total = 0.0;
               foreach (var order in Model.DonDatHangModel.GetModel.LstObjModel)
               {
                   foreach (var detail in order.ChiTietDonDatHang)
                   {
                       total += (detail.SoLuong.Value * detail.Gia.Value);
                   }
               }
        %>
        Tổng doanh thu: <span id="Span1" style="font-weight: bold; color: Red">
            <%= string.Format("{0:0,0}", total)%>
            Đ</span>
        <br />
        <br />
        <div id="Div1">
            <% Html.RenderPartial("Templates/TH_PrintListOrders", Model); %>
        </div>
        <br />
        <br />
        <% } %>
    </div>
</asp:Content>
